<template>
  <el-container class="home_container">
    <!-- 头部区域 -->
    <el-header>
      <div>
        <img src="../assets/logo.jpg" alt="">
        <span>烛逢后台管理系统</span>
      </div>
      <el-button type="info" @click="logout">退出</el-button>
    </el-header>
    <!-- 页面主体区 -->
    <el-container>
      <!-- 侧边栏 -->
      <el-aside :width="isCollapse ? '64px': '200px'">
        <div class="toggle_botton" @click="toggle_Collapse">|||</div>
        <el-menu
          background-color="#333744"
          text-color="#fff"
          active-text-color="#409EFF"
          :unique-opened="true"
          :collapse="isCollapse"
          :collapse-transition="false"
          :router="true">
        <!-- 系统首页 -->
          <el-menu-item index="welcome">
            <i class="el-icon-position"></i>
            <span slot="title">系统首页</span>
          </el-menu-item>
        <!-- 学生认证 -->
          <el-menu-item index="certification">
            <i class="el-icon-user"></i>
            <span slot="title">学生认证</span>
          </el-menu-item>
        <!-- 订单信息一级菜单 -->
          <el-submenu index="1">
            <!-- 一级菜单的模板区域 -->
            <template slot="title">
              <!-- 图标 -->
              <i class="el-icon-document"></i>
              <span>订单信息</span>
            </template>
            <!-- 二级菜单 -->
            <el-menu-item index="orderrun">
              <i class="el-icon-menu"></i>
              <span>进行中订单</span>
            </el-menu-item>
            <el-menu-item index="orderend">
              <i class="el-icon-menu"></i>
              <span>已结束订单</span>
            </el-menu-item>
          </el-submenu>
        <!-- 活动上传 -->
          <el-menu-item index="activity">
            <i class="el-icon-thumb"></i>
            <span slot="title">活动上传</span>
          </el-menu-item>
        <!-- 用户管理 -->
          <el-submenu index='2'>
            <template slot="title">
              <i class="el-icon-setting"></i>
              <span>用户管理</span>
            </template>
            <el-menu-item index="traveler">
              <i class="el-icon-menu"></i>
              <span>旅行者管理</span>
            </el-menu-item>
            <el-menu-item index="leader">
              <i class="el-icon-menu"></i>
              <span>领队管理</span>
            </el-menu-item>
            <el-menu-item index="candle">
              <i class="el-icon-menu"></i>
              <span>小蜡烛管理</span>
            </el-menu-item>
          </el-submenu>
        </el-menu>
    </el-aside>
      <!-- 右侧内容主体 -->
      <el-main>
        <!-- 路由占位符 -->
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  data () {
    return {
      // 是否折叠
      isCollapse: false
    }
  },
  methods: {
    //   退出按钮功能
    logout () {
      window.sessionStorage.clear()
      this.$router.push('/login')
    },
    // 点击按钮，折叠/展开菜单
    toggle_Collapse () {
      this.isCollapse = !this.isCollapse
    }
  }
}
</script>

<style lang="less" scoped>
.home_container{
  height: 100%;
}

.el-header{
  background-color: #373d41;
  display: flex;
  justify-content: space-between;
  padding-left: 0;
  align-items: center;
  // 文本
  color: #fff;
  font-size: 20px;
  div{
    display: flex;
    align-items: center;
    span{
      margin-left: 15px;
    }
  }
  img{
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #eee;
  }
}

.el-aside{
  background-color: #333744;
  .el-menu{
    border-right: 0px;
  }
}

.el-main{
  background-color: #EAEDF1;
}

.toggle_botton{
  background-color: #4A5064;
  font-size: 10px;
  line-height: 24px;
  color: #fff;
  text-align: center;
  letter-spacing: 0.2em;
  cursor: pointer;
}
</style>
